#ifndef __OC_DynLibManager_H__
#define __OC_DynLibManager_H__

#include "Prerequisites.h"
#include "Singleton.h"

namespace OCPP {
    /** \addtogroup Core
    *  @{
    */
    /** \addtogroup General
    *  @{
    */
    /** Manager for Dynamic-loading Libraries.
    @remarks
        This manager keeps a track of all the open dynamic-loading
        libraries, opens them and returns references to already-open
        libraries.
    */
    class _MainExport DynLibManager: public CSingleton<DynLibManager>
    {
    private:
        typedef std::map<String, DynLib*> DynLibList;
        DynLibList mLibList;
    public:
        /** Default constructor.
        @note
            <br>Should never be called as the singleton is automatically
            created during the creation of the Root object.
        @see
            Root::Root
        */
        DynLibManager();

        /** Default destructor.
        @see
            Root::~Root
        */
        ~DynLibManager();

        /** Loads the passed library.
        @param filename
            The name of the library. The extension can be omitted.
        */
        DynLib* load(const String& filename);

        /** Unloads the passed library.
        @param lib
            The library.
        */
        void unload(DynLib* lib);

        /// @copydoc Singleton::getSingleton()
        static DynLibManager& getSingleton(void);
        /// @copydoc Singleton::getSingleton()
        static DynLibManager* getSingletonPtr(void);
    };
    /** @} */
    /** @} */
} // namespace Ogre

#endif // __DynLibManager_H__
